/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.pangalacteos.modelo;

/**
 *
 * @author Leandro Del Sole
 */
public enum DBFieldType {
    STRING, DATE, INTEGER, FLOAT, FORNECEDOR;
    
    @Deprecated
    /**
     * Use valueOf instead
     */
    public static DBFieldType descobreTipo(String tipo) {
        try {
            if (tipo.equals("Date")){
                return DBFieldType.DATE;
            } else if (tipo.equalsIgnoreCase("Integer")){
                return DBFieldType.INTEGER;
            } else if (tipo.equalsIgnoreCase("String")){
                return DBFieldType.STRING;
            } else if (tipo.equalsIgnoreCase("Float")){
                return DBFieldType.FLOAT;
            } else if (tipo.equalsIgnoreCase("Fornecedor")){
                return DBFieldType.FORNECEDOR;
            }
            
            return null;
        } catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
    
    @Deprecated
    public static Object parseType(DBFieldType tipo){
        if (tipo == DBFieldType.DATE){
            return DBFieldType.DATE;
        } else if (tipo == DBFieldType.INTEGER){
            return DBFieldType.INTEGER;
        } else if (tipo == DBFieldType.STRING){
            return DBFieldType.STRING;
        } else if (tipo == DBFieldType.FLOAT){
            return DBFieldType.FLOAT;
        } else if (tipo == DBFieldType.FORNECEDOR){
            return DBFieldType.FORNECEDOR;
        }
        
        return null;
    }
}
